package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"net/http"
)

func getting(c *gin.Context) {
	fmt.Printf("请求方法为:%s", c.Request.Method)
	fmt.Println()
	//name := c.Query("name")
	c.String(http.StatusOK, "成功以%s访问该页面", c.Request.Method)
}

func main() {
	router := gin.Default()
	//New()去掉了默认的两个中间件，也没有recover
	//gin.New()

	//restful的开发
	router.GET("/someGet/", getting)
	/*routers.POST("/somePost", posting)
	routers.PUT("/somePut", putting)
	routers.DELETE("/someDelete", deleting)
	routers.PATCH("/somePatch", patching)
	routers.HEAD("/someHead", head)
	routers.OPTIONS("/someOptions", options)
	*/

	router.Run()
}
